package crmsystem.com.service.impl;

import crmsystem.com.utils.Query;
import crmsystem.com.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import crmsystem.com.dao.MechanismDao;
import crmsystem.com.entity.MechanismEntity;
import crmsystem.com.service.MechanismService;


@Service("mechanismService")
public class MechanismServiceImpl extends ServiceImpl<MechanismDao, MechanismEntity> implements MechanismService {

    @Autowired
    MechanismDao mechanismDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MechanismEntity> page = this.page(
                new Query<MechanismEntity>().getPage(params),
                new QueryWrapper<MechanismEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<MechanismEntity> getByMechName(String mechname) {
        return mechanismDao.selectByMechName(mechname);
    }

    @Override
    public List<MechanismEntity> getByIndex(String index) {
        return mechanismDao.selectByIndex(index);
    }

}